package com.hwl.demo8;

import com.hwl.demo8.entity.NationalDebt1;
import com.hwl.demo8.entity.Realty1;
import com.hwl.demo8.entity.Stock1;
import com.hwl.demo8.entity.Stock2;

/**
 * 外观模式
 *
 * @author sentry
 * @since 2023-03-19
 */
public class Fund {

    Stock1 stock1;
    Stock2 stock2;
    NationalDebt1 nd1;
    Realty1 rt1;

    public Fund() {
        stock1 = new Stock1();
        stock2 = new Stock2();
        nd1 = new NationalDebt1();
        rt1 = new Realty1();
    }

    public static void main(String[] args) {
        Fund fund = new Fund();
        fund.buyFund();
        fund.sellFund();
    }

    public void buyFund() {
        stock1.buy();
        stock2.buy();
        nd1.buy();
        rt1.buy();
    }

    public void sellFund() {
        stock1.sell();
        stock2.sell();
        nd1.sell();
        rt1.sell();
    }
}
